#' Online rolling cov
#'
#' @param period rolling window period
#' @param type type of the rolling window
#'
#' @return a stateful function
#' @export
#'
new_rollcov <- function(period, type = c("ro", "ew", "cu"))
{
  type <- match.arg(type)
  switch(type,
         ro = mk_online_func_x("rollcov", period),
         ew = mk_online_func_x("rollcov_ew", period),
         cu = mk_online_func_x("rollcov_cu"))
}

#' Online rolling corr
#'
#' @param period rolling window period
#' @param type type of the rolling window
#'
#' @return a stateful function
#' @export
#'
new_rollcorr <- function(period, type = c("ro", "ew", "cu"))
{
  type <- match.arg(type)
  switch(type,
         ro = mk_online_func_x("rollcorr", period),
         ew = mk_online_func_x("rollcorr_ew", period),
         cu = mk_online_func_x("rollcorr_cu", period))
}

#' Online rolling beta
#'
#' @param period rolling window period
#' @param type type of the rolling window
#'
#' @return a stateful function
#' @export
#'
new_rollbeta <- function(period, type = c("ro", "cu"))
{
  type <- match.arg(type)
  switch(type,
         ro = mk_online_func_x("rollbeta", period),
         cu = mk_online_func_x("rollbeta_cu"))
}
